package com.szh.zx.gaoDingJavaBook.chapter7.two;

import java.io.Serializable;

public class Wolf implements Serializable {
	String name;

	public Wolf(String name) {
		System.out.println("调用有参数的构造器");
		this.name = name;
	}

	@Override
	public boolean equals(Object obj) {
		if (this ==obj){
			return true;
		}
		if (obj.getClass() == Wolf.class){
			Wolf target = (Wolf) obj;
			return target.name.equals(this.name);
		}
		return false;
	}

	@Override
	public int hashCode() {
		return name.hashCode();
	}
}
